1use crate::co;
2use crate::decl::*;
3use crate::kernel::privs::*;
4use crate::msg::*;
5use crate::prelude::*;
6use crate::user::privs::*;
7
8pub struct AddFile {
13 pub text: WString,
14}
15
16impl MsgSend for AddFile {
17 type RetType = SysResult<u32>;
18
19 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
20 match v as i32 {
21 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
22 LB_ERRSPACE => Err(co::ERROR::NOT_ENOUGH_MEMORY),
23 idx => Ok(idx as _),
24 }
25 }
26
27 fn as_generic_wm(&mut self) -> WndMsg {
28 WndMsg {
29 msg_id: co::LB::ADDFILE.into(),
30 wparam: 0,
31 lparam: self.text.as_ptr() as _,
32 }
33 }
34}
35
36pub struct AddString {
41 pub text: WString,
42}
43
44impl MsgSend for AddString {
45 type RetType = SysResult<u32>;
46
47 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
48 match v as i32 {
49 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
50 LB_ERRSPACE => Err(co::ERROR::NOT_ENOUGH_MEMORY),
51 idx => Ok(idx as _),
52 }
53 }
54
55 fn as_generic_wm(&mut self) -> WndMsg {
56 WndMsg {
57 msg_id: co::LB::ADDSTRING.into(),
58 wparam: 0,
59 lparam: self.text.as_ptr() as _,
60 }
61 }
62}
63
64pub struct DeleteString {
69 pub index: u32,
70}
71
72impl MsgSend for DeleteString {
73 type RetType = SysResult<u32>;
74
75 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
76 match v as i32 {
77 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
78 count => Ok(count as _),
79 }
80 }
81
82 fn as_generic_wm(&mut self) -> WndMsg {
83 WndMsg {
84 msg_id: co::LB::DELETESTRING.into(),
85 wparam: self.index as _,
86 lparam: 0,
87 }
88 }
89}
90
91pub struct Dir {
96 pub attributes: co::DDL,
97 pub path: WString,
98}
99
100impl MsgSend for Dir {
101 type RetType = SysResult<u32>;
102
103 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
104 match v as i32 {
105 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
106 LB_ERRSPACE => Err(co::ERROR::NOT_ENOUGH_MEMORY),
107 idx => Ok(idx as _),
108 }
109 }
110
111 fn as_generic_wm(&mut self) -> WndMsg {
112 WndMsg {
113 msg_id: co::LB::DIR.into(),
114 wparam: self.attributes.raw() as _,
115 lparam: self.path.as_ptr() as _,
116 }
117 }
118}
119
120pub struct FindString {
125 pub preceding_index: Option<u32>,
126 pub text: WString,
127}
128
129impl MsgSend for FindString {
130 type RetType = Option<u32>;
131
132 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
133 match v as i32 {
134 LB_ERR => None,
135 idx => Some(idx as _),
136 }
137 }
138
139 fn as_generic_wm(&mut self) -> WndMsg {
140 WndMsg {
141 msg_id: co::LB::FINDSTRING.into(),
142 wparam: self.preceding_index.map_or(-1, |idx| idx as i32) as _,
143 lparam: self.text.as_ptr() as _,
144 }
145 }
146}
147
148pub struct FindStringExact {
153 pub preceding_index: Option<u32>,
154 pub text: WString,
155}
156
157impl MsgSend for FindStringExact {
158 type RetType = Option<u32>;
159
160 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
161 match v as i32 {
162 LB_ERR => None,
163 idx => Some(idx as _),
164 }
165 }
166
167 fn as_generic_wm(&mut self) -> WndMsg {
168 WndMsg {
169 msg_id: co::LB::FINDSTRINGEXACT.into(),
170 wparam: self.preceding_index.map_or(-1, |idx| idx as i32) as _,
171 lparam: self.text.as_ptr() as _,
172 }
173 }
174}
175
176pub struct GetAnchorIndex {}
181
182impl MsgSend for GetAnchorIndex {
183 type RetType = u32;
184
185 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
186 v as _
187 }
188
189 fn as_generic_wm(&mut self) -> WndMsg {
190 WndMsg {
191 msg_id: co::LB::GETANCHORINDEX.into(),
192 wparam: 0,
193 lparam: 0,
194 }
195 }
196}
197
198pub struct GetCaretIndex {}
203
204impl MsgSend for GetCaretIndex {
205 type RetType = u32;
206
207 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
208 v as _
209 }
210
211 fn as_generic_wm(&mut self) -> WndMsg {
212 WndMsg {
213 msg_id: co::LB::GETCARETINDEX.into(),
214 wparam: 0,
215 lparam: 0,
216 }
217 }
218}
219
220pub struct GetCount {}
225
226impl MsgSend for GetCount {
227 type RetType = SysResult<u32>;
228
229 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
230 match v as i32 {
231 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
232 count => Ok(count as _),
233 }
234 }
235
236 fn as_generic_wm(&mut self) -> WndMsg {
237 WndMsg {
238 msg_id: co::LB::GETCOUNT.into(),
239 wparam: 0,
240 lparam: 0,
241 }
242 }
243}
244
245pub struct GetCurSel {}
250
251impl MsgSend for GetCurSel {
252 type RetType = Option<u32>;
253
254 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
255 match v as i32 {
256 LB_ERR => None,
257 idx => Some(idx as _),
258 }
259 }
260
261 fn as_generic_wm(&mut self) -> WndMsg {
262 WndMsg {
263 msg_id: co::LB::GETCURSEL.into(),
264 wparam: 0,
265 lparam: 0,
266 }
267 }
268}
269
270pub struct GetHorizontalExtent {}
275
276impl MsgSend for GetHorizontalExtent {
277 type RetType = u32;
278
279 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
280 v as _
281 }
282
283 fn as_generic_wm(&mut self) -> WndMsg {
284 WndMsg {
285 msg_id: co::LB::GETHORIZONTALEXTENT.into(),
286 wparam: 0,
287 lparam: 0,
288 }
289 }
290}
291
292pub struct GetItemData {
297 pub index: u32,
298}
299
300impl MsgSend for GetItemData {
301 type RetType = SysResult<isize>;
302
303 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
304 const LB_ERR_ISIZE: isize = LB_ERR as _;
305 match v {
306 LB_ERR_ISIZE => Err(co::ERROR::BAD_ARGUMENTS),
307 data => Ok(data),
308 }
309 }
310
311 fn as_generic_wm(&mut self) -> WndMsg {
312 WndMsg {
313 msg_id: co::LB::GETITEMDATA.into(),
314 wparam: self.index as _,
315 lparam: 0,
316 }
317 }
318}
319
320pub struct GetItemHeight {
325 pub index: Option<u32>,
326}
327
328impl MsgSend for GetItemHeight {
329 type RetType = SysResult<u8>;
330
331 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
332 match v as i32 {
333 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
334 height => Ok(height as _),
335 }
336 }
337
338 fn as_generic_wm(&mut self) -> WndMsg {
339 WndMsg {
340 msg_id: co::LB::GETITEMHEIGHT.into(),
341 wparam: self.index.unwrap_or(0) as _,
342 lparam: 0,
343 }
344 }
345}
346
347pub struct GetItemRect<'a> {
352 pub index: u32,
353 pub rect: &'a mut RECT,
354}
355
356impl<'a> MsgSend for GetItemRect<'a> {
357 type RetType = SysResult<()>;
358
359 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
360 match v as i32 {
361 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
362 _ => Ok(()),
363 }
364 }
365
366 fn as_generic_wm(&mut self) -> WndMsg {
367 WndMsg {
368 msg_id: co::LB::GETITEMRECT.into(),
369 wparam: self.index as _,
370 lparam: self.rect as *mut _ as _,
371 }
372 }
373}
374
375pub struct GetListBoxInfo {}
380
381impl MsgSend for GetListBoxInfo {
382 type RetType = u32;
383
384 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
385 v as _
386 }
387
388 fn as_generic_wm(&mut self) -> WndMsg {
389 WndMsg {
390 msg_id: co::LB::GETLISTBOXINFO.into(),
391 wparam: 0,
392 lparam: 0,
393 }
394 }
395}
396
397pub struct GetLocale {}
402
403impl MsgSend for GetLocale {
404 type RetType = LCID;
405
406 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
407 unsafe { LCID::from_raw(v as _) }
408 }
409
410 fn as_generic_wm(&mut self) -> WndMsg {
411 WndMsg {
412 msg_id: co::LB::GETLOCALE.into(),
413 wparam: 0,
414 lparam: 0,
415 }
416 }
417}
418
419pub struct GetSel {
424 pub index: u32,
425}
426
427impl MsgSend for GetSel {
428 type RetType = SysResult<bool>;
429
430 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
431 match v as i32 {
432 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
433 status => Ok(status != 0),
434 }
435 }
436
437 fn as_generic_wm(&mut self) -> WndMsg {
438 WndMsg {
439 msg_id: co::LB::GETSEL.into(),
440 wparam: self.index as _,
441 lparam: 0,
442 }
443 }
444}
445
446pub struct GetSelCount {}
451
452impl MsgSend for GetSelCount {
453 type RetType = SysResult<u32>;
454
455 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
456 match v as i32 {
457 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
458 count => Ok(count as _),
459 }
460 }
461
462 fn as_generic_wm(&mut self) -> WndMsg {
463 WndMsg {
464 msg_id: co::LB::GETSELCOUNT.into(),
465 wparam: 0,
466 lparam: 0,
467 }
468 }
469}
470
471pub struct GetSelItems<'a> {
476 pub buffer: &'a mut [u32],
477}
478
479impl<'a> MsgSend for GetSelItems<'a> {
480 type RetType = SysResult<u32>;
481
482 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
483 match v as i32 {
484 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
485 count => Ok(count as _),
486 }
487 }
488
489 fn as_generic_wm(&mut self) -> WndMsg {
490 WndMsg {
491 msg_id: co::LB::GETSELITEMS.into(),
492 wparam: self.buffer.len(),
493 lparam: self.buffer.as_mut_ptr() as _,
494 }
495 }
496}
497
498pub struct GetText<'a> {
503 pub index: u32,
504 pub text: &'a mut WString,
505}
506
507impl<'a> MsgSend for GetText<'a> {
508 type RetType = SysResult<u32>;
509
510 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
511 match v as i32 {
512 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
513 nchars => Ok(nchars as _),
514 }
515 }
516
517 fn as_generic_wm(&mut self) -> WndMsg {
518 WndMsg {
519 msg_id: co::LB::GETTEXT.into(),
520 wparam: self.index as _,
521 lparam: unsafe { self.text.as_mut_ptr() } as _,
522 }
523 }
524}
525
526pub struct GetTextLen {
531 pub index: u32,
532}
533
534impl MsgSend for GetTextLen {
535 type RetType = SysResult<u32>;
536
537 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
538 match v as i32 {
539 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
540 nchars => Ok(nchars as _),
541 }
542 }
543
544 fn as_generic_wm(&mut self) -> WndMsg {
545 WndMsg {
546 msg_id: co::LB::GETTEXTLEN.into(),
547 wparam: self.index as _,
548 lparam: 0,
549 }
550 }
551}
552
553pub struct GetTopIndex {}
558
559impl MsgSend for GetTopIndex {
560 type RetType = SysResult<u32>;
561
562 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
563 match v as i32 {
564 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
565 idx => Ok(idx as _),
566 }
567 }
568
569 fn as_generic_wm(&mut self) -> WndMsg {
570 WndMsg {
571 msg_id: co::LB::GETTOPINDEX.into(),
572 wparam: 0,
573 lparam: 0,
574 }
575 }
576}
577
578pub struct InitStorage {
583 pub num_items: u32,
584 pub memory_bytes: u32,
585}
586
587impl MsgSend for InitStorage {
588 type RetType = SysResult<u32>;
589
590 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
591 match v as i32 {
592 LB_ERRSPACE => Err(co::ERROR::BAD_ARGUMENTS),
593 n_items => Ok(n_items as _),
594 }
595 }
596
597 fn as_generic_wm(&mut self) -> WndMsg {
598 WndMsg {
599 msg_id: co::LB::INITSTORAGE.into(),
600 wparam: self.num_items as _,
601 lparam: self.memory_bytes as _,
602 }
603 }
604}
605
606pub struct InsertString {
611 pub insertion_index: Option<u32>,
612 pub text: WString,
613}
614
615impl MsgSend for InsertString {
616 type RetType = SysResult<u32>;
617
618 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
619 match v as i32 {
620 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
621 LB_ERRSPACE => Err(co::ERROR::NOT_ENOUGH_MEMORY),
622 idx => Ok(idx as _),
623 }
624 }
625
626 fn as_generic_wm(&mut self) -> WndMsg {
627 WndMsg {
628 msg_id: co::LB::INSERTSTRING.into(),
629 wparam: self.insertion_index.map_or(-1, |idx| idx as i32) as _,
630 lparam: self.text.as_ptr() as _,
631 }
632 }
633}
634
635pub struct ItemFromPoint {
640 pub coords: POINT,
641}
642
643impl MsgSend for ItemFromPoint {
644 type RetType = (i32, bool);
645
646 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
647 (LOWORD(v as _) as _, HIWORD(v as _) == 1)
648 }
649
650 fn as_generic_wm(&mut self) -> WndMsg {
651 WndMsg {
652 msg_id: co::LB::ITEMFROMPOINT.into(),
653 wparam: 0,
654 lparam: u32::from(self.coords) as _,
655 }
656 }
657}
658
659pub_struct_msg_empty! { ResetContent: co::LB::RESETCONTENT.into();
660 }
662
663pub struct SelectString {
668 pub index: Option<u32>,
669 pub prefix: WString,
670}
671
672impl MsgSend for SelectString {
673 type RetType = SysResult<u32>;
674
675 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
676 match v as i32 {
677 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
678 LB_ERRSPACE => Err(co::ERROR::NOT_ENOUGH_MEMORY),
679 idx => Ok(idx as _),
680 }
681 }
682
683 fn as_generic_wm(&mut self) -> WndMsg {
684 WndMsg {
685 msg_id: co::LB::SELECTSTRING.into(),
686 wparam: self.index.map_or(-1, |idx| idx as i32) as _,
687 lparam: self.prefix.as_ptr() as _,
688 }
689 }
690}
691
692pub struct SelItemRange {
697 pub select: bool,
698 pub first_item: u16,
699 pub last_item: u16,
700}
701
702impl MsgSend for SelItemRange {
703 type RetType = SysResult<()>;
704
705 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
706 match v as i32 {
707 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
708 _ => Ok(()),
709 }
710 }
711
712 fn as_generic_wm(&mut self) -> WndMsg {
713 WndMsg {
714 msg_id: co::LB::SELITEMRANGE.into(),
715 wparam: self.select as _,
716 lparam: MAKEDWORD(self.first_item, self.last_item) as _,
717 }
718 }
719}
720
721pub struct SelItemRangeEx {
726 pub first_index: u32,
727 pub last_index: u32,
728}
729
730impl MsgSend for SelItemRangeEx {
731 type RetType = SysResult<()>;
732
733 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
734 match v as i32 {
735 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
736 _ => Ok(()),
737 }
738 }
739
740 fn as_generic_wm(&mut self) -> WndMsg {
741 WndMsg {
742 msg_id: co::LB::SELITEMRANGEEX.into(),
743 wparam: self.first_index as _,
744 lparam: self.last_index as _,
745 }
746 }
747}
748
749pub struct SetAnchorIndex {
754 pub index: u32,
755}
756
757impl MsgSend for SetAnchorIndex {
758 type RetType = SysResult<()>;
759
760 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
761 match v as i32 {
762 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
763 _ => Ok(()),
764 }
765 }
766
767 fn as_generic_wm(&mut self) -> WndMsg {
768 WndMsg {
769 msg_id: co::LB::SETANCHORINDEX.into(),
770 wparam: self.index as _,
771 lparam: 0,
772 }
773 }
774}
775
776pub struct SetCaretIndex {
781 pub index: u32,
782 pub at_least_partially_visible: bool,
783}
784
785impl MsgSend for SetCaretIndex {
786 type RetType = SysResult<()>;
787
788 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
789 match v as i32 {
790 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
791 _ => Ok(()),
792 }
793 }
794
795 fn as_generic_wm(&mut self) -> WndMsg {
796 WndMsg {
797 msg_id: co::LB::SETCARETINDEX.into(),
798 wparam: self.index as _,
799 lparam: self.at_least_partially_visible as _,
800 }
801 }
802}
803
804pub struct SetColumnWidth {
809 pub width: u32,
810}
811
812impl MsgSend for SetColumnWidth {
813 type RetType = ();
814
815 unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
816 ()
817 }
818
819 fn as_generic_wm(&mut self) -> WndMsg {
820 WndMsg {
821 msg_id: co::LB::SETCOLUMNWIDTH.into(),
822 wparam: self.width as _,
823 lparam: 0,
824 }
825 }
826}
827
828pub struct SetCount {
833 pub new_count: u32,
834}
835
836impl MsgSend for SetCount {
837 type RetType = SysResult<()>;
838
839 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
840 match v as i32 {
841 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
842 LB_ERRSPACE => Err(co::ERROR::NOT_ENOUGH_MEMORY),
843 _ => Ok(()),
844 }
845 }
846
847 fn as_generic_wm(&mut self) -> WndMsg {
848 WndMsg {
849 msg_id: co::LB::SETCOUNT.into(),
850 wparam: self.new_count as _,
851 lparam: 0,
852 }
853 }
854}
855
856pub struct SetCurSel {
861 pub index: Option<u32>,
862}
863
864impl MsgSend for SetCurSel {
865 type RetType = SysResult<()>;
866
867 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
868 if let None = self.index {
869 Ok(())
870 } else {
871 match v as i32 {
872 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
873 _ => Ok(()),
874 }
875 }
876 }
877
878 fn as_generic_wm(&mut self) -> WndMsg {
879 WndMsg {
880 msg_id: co::LB::SETCURSEL.into(),
881 wparam: self.index.map_or(-1, |idx| idx as i32) as _,
882 lparam: 0,
883 }
884 }
885}
886
887pub struct SetHorizontalExtent {
892 pub width: u32,
893}
894
895impl MsgSend for SetHorizontalExtent {
896 type RetType = ();
897
898 unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
899 ()
900 }
901
902 fn as_generic_wm(&mut self) -> WndMsg {
903 WndMsg {
904 msg_id: co::LB::SETHORIZONTALEXTENT.into(),
905 wparam: self.width as _,
906 lparam: 0,
907 }
908 }
909}
910
911pub struct SetItemData {
916 pub index: u32,
917 pub data: isize,
918}
919
920impl MsgSend for SetItemData {
921 type RetType = SysResult<()>;
922
923 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
924 match v as i32 {
925 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
926 _ => Ok(()),
927 }
928 }
929
930 fn as_generic_wm(&mut self) -> WndMsg {
931 WndMsg {
932 msg_id: co::LB::SETITEMDATA.into(),
933 wparam: self.index as _,
934 lparam: self.data,
935 }
936 }
937}
938
939pub struct SetItemHeight {
944 pub index: Option<u32>,
945 pub height: u8,
946}
947
948impl MsgSend for SetItemHeight {
949 type RetType = SysResult<()>;
950
951 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
952 match v as i32 {
953 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
954 _ => Ok(()),
955 }
956 }
957
958 fn as_generic_wm(&mut self) -> WndMsg {
959 WndMsg {
960 msg_id: co::LB::SETITEMHEIGHT.into(),
961 wparam: self.index.unwrap_or(0) as _,
962 lparam: self.height as _,
963 }
964 }
965}
966
967pub struct SetLocale {
972 pub locale: LCID,
973}
974
975impl MsgSend for SetLocale {
976 type RetType = SysResult<LCID>;
977
978 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
979 match v as i32 {
980 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
981 lcid => Ok(unsafe { LCID::from_raw(lcid as _) }),
982 }
983 }
984
985 fn as_generic_wm(&mut self) -> WndMsg {
986 WndMsg {
987 msg_id: co::LB::SETLOCALE.into(),
988 wparam: u32::from(self.locale) as _,
989 lparam: 0,
990 }
991 }
992}
993
994pub struct SetSel {
999 pub select: bool,
1000 pub index: Option<u32>,
1001}
1002
1003impl MsgSend for SetSel {
1004 type RetType = SysResult<()>;
1005
1006 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1007 match v as i32 {
1008 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
1009 _ => Ok(()),
1010 }
1011 }
1012
1013 fn as_generic_wm(&mut self) -> WndMsg {
1014 WndMsg {
1015 msg_id: co::LB::SETSEL.into(),
1016 wparam: self.select as _,
1017 lparam: self.index.map_or(-1, |idx| idx as i32) as _,
1018 }
1019 }
1020}
1021
1022pub struct SetTabStops<'a> {
1027 pub tab_stops: &'a [u32],
1028}
1029
1030impl<'a> MsgSend for SetTabStops<'a> {
1031 type RetType = SysResult<()>;
1032
1033 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1034 zero_as_badargs(v).map(|_| ())
1035 }
1036
1037 fn as_generic_wm(&mut self) -> WndMsg {
1038 WndMsg {
1039 msg_id: co::LB::SETTABSTOPS.into(),
1040 wparam: self.tab_stops.len(),
1041 lparam: vec_ptr(self.tab_stops) as _,
1042 }
1043 }
1044}
1045
1046pub struct SetTopIndex {
1051 pub index: u32,
1052}
1053
1054impl MsgSend for SetTopIndex {
1055 type RetType = SysResult<()>;
1056
1057 unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1058 match v as i32 {
1059 LB_ERR => Err(co::ERROR::BAD_ARGUMENTS),
1060 _ => Ok(()),
1061 }
1062 }
1063
1064 fn as_generic_wm(&mut self) -> WndMsg {
1065 WndMsg {
1066 msg_id: co::LB::SETTOPINDEX.into(),
1067 wparam: self.index as _,
1068 lparam: 0,
1069 }
1070 }
1071}